package com.example.vip1.zerenlian;

/**
 * *******************************************************
 * Author: chinadragon
 * Time: 8/15/21 9:59 PM
 * Name:
 * Overview:
 * Usage:
 * *******************************************************
 */
public abstract class BaseTask {
    //判断当前节点有没有能力执行，有直接返回，没有继续传递节点
    private boolean isTask;

    public BaseTask(boolean isTask) {
        this.isTask = isTask;
    }

    //节点需要向下传递
    private BaseTask nextTask;

    public void addNext(BaseTask nextTask) {
        this.nextTask = nextTask;
    }

    public abstract void doAction();

    public void action() {
        if (isTask) {
            doAction();
        }else {
            if (nextTask != null) {
                nextTask.doAction();
            }
        }
    }
}
